<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : playlistFO.xsl
    Created on : April 4, 2013, 9:40 PM
    Author     : tiwtiger
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
    xmlns:s="http://xml.netbeans.org/schema/playlist"
    exclude-result-prefixes="s"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">
<!--    <xsl:output method="html"/>-->

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="content"
                page-height="8.5in" page-width="12in"
                margin-top="0.5in" margin-bottom="0.5in"
                margin-left="1in" margin-right="1in">
                    <fo:region-body margin-top="0.5in"/>
                    <fo:region-before extent="1in"/>
                    <fo:region-after extent=".75in"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="content">
                <fo:static-content flow-name="xsl-region-before">
                    <fo:block font-size="14pt" font-family="Arial" line-height="23pt"
                            space-after.optimum="15pt" text-align="center" padding-top="3pt">
                            PLAYLIST'S INFORMATION
                    </fo:block>
                </fo:static-content>
                <fo:static-content flow-name="xsl-region-after">
                    <fo:block font-size="18pt" font-family="Arial" line-height="23pt"
                            space-after.optimum="15pt" text-align="center" padding-top="3pt">
                    </fo:block>
                </fo:static-content>
                <fo:flow flow-name="xsl-region-body">
<!--                    <fo:block font-size="14pt" font-family="Arial" line-height="23pt"
                            space-after.optimum="15pt" text-align="center" padding-top="3pt">
                            ARTIST'S INFORMATION
                    </fo:block>-->
                    <fo:block>
                        <fo:table border-collapse="separate" table-layout="fixed">
                            <fo:table-column column-width="2cm"/>
                            <fo:table-column column-width="4cm"/>
                            <fo:table-column column-width="4cm"/>
                            <fo:table-column column-width="6cm"/>
                            <fo:table-column column-width="2cm"/>
                            <fo:table-column column-width="2cm"/>

                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">Playlist ID</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">Playlist Name</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">User Name</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">Description</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">Like Number</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                        <fo:block text-align="center">Listen number</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <xsl:for-each select="s:Playlists/s:Playlist">
                                    <xsl:sort select="s:ListenNumber" order="descending" data-type="number" />
                                    <fo:table-row>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block>
                                                <xsl:value-of select="s:PlaylistID"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block font-family="Arial">
                                                <xsl:value-of select="s:PlaylistName"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block font-family="Arial">
                                                <xsl:value-of select="s:Username"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block font-family="Arial">
                                                <xsl:value-of select="s:PlaylistDescription"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block>
                                                <xsl:value-of select="s:PlaylistLikeNumber"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell border-color="black" border-width="0.5pt" border-style="solid">
                                            <fo:block>
                                                <xsl:value-of select="s:ListenNumber"/>
                                            </fo:block>
                                        </fo:table-cell>
                                    </fo:table-row>
                                </xsl:for-each>
                            </fo:table-body>
                        </fo:table>
                    </fo:block>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>

</xsl:stylesheet>
